package org.zzul.ctrl;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.zzul.util.JedisUtils;
@RestController
public class TestEdis extends JedisUtils{
	
	@RequestMapping("/edis1")
	public String test() {
		this.set("msg4", "444");
		this.expire("msg4", 120);
		return this.get("msg4");
	}
	@RequestMapping("/edis2")
	public String test2() {
		this.hset("msg5", "k5","555");
		return this.hget("msg5", "k5");
	}
	
	@RequestMapping("/edis3")
	public String test3() {
		this.incr("msg4");
		return this.get("msg4");
	}
	
	@RequestMapping("/edis4")
	public String test4() {
		this.incr("msg4");
		System.out.println(this.ttl("msg4"));
		return this.get("msg4");
	}
	
	@RequestMapping("/edis5")
	public String test5() {
		this.del("msg5");
		return "ok";
	}
	
	
//	public static void main(String[] args) {
//		Jedis edis=new Jedis();
////		edis.set("msg2", "hello");
////		System.out.println(edis.get("msg2"));
////		edis.hset("msg3", "k1", "val");
////		System.out.println(edis.hget("msg3", "k1"));
//		edis.lpush("msg4", "a","b","c");
//		System.out.println(edis.lrange("msg4", 0, 1));
//	}
}
